//index.js
//获取应用实例
var app = getApp()
Page({
  data: {
  },
  onLoad:function(){
    var that = this;
    that.setData({
      userInfo: app.globalData.userInfo
    })
    wx.getStorage({
      key: "couponInfo",
      success: function (res) {
        console.log(res.data);
        that.setData({
          couponDetail: res.data.couponDetail,
          receiveList: res.data.receiveList
        })
      }
    })
  },
  
  // 优惠券
  toMycoupon: function () {
    wx.redirectTo({
      url: '/subpages/myCoupon/myCoupon'
    })
  },
  toIndexuse: function () {
    app.backHome();
  },
  toAllgoods: function (e) {
    var id = e.currentTarget.dataset.id;
    var type = e.currentTarget.dataset.type;
    var limit = e.currentTarget.dataset.limit;
    var value = e.currentTarget.dataset.value;
    wx.redirectTo({
      url: '/subpages1/searchList/searchList?id=' + id + '&type=' + type + '&limit=' + limit + '&value=' + value
    })
  },
  toShareCoupon: function (e) {
    var id = e.target.dataset.id;
    if (!id) {
      return;
    }
    wx.navigateTo({
      url: '/subpages/shareCoupon/shareCoupon?id=' + id
    })
  },
})
